package com.ygqh.baby.mapper;

import com.ygqh.baby.ao.PromotionType;
import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.ao.SalesPlatform;
import com.ygqh.baby.model.BaseSkuInfo;
import com.ygqh.baby.model.ShoppingCarBasicData;
import com.ygqh.baby.model.YgPtSkuInfo;
import com.ygqh.baby.model.YgShoppingCarModel;
import com.ygqh.baby.po.YgShoppingCar;
import com.ygqh.baby.po.YgShoppingCarExample;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author admin
 */
public interface YgShoppingCarMapper {
    int countByExample(YgShoppingCarExample example);

    int deleteByExample(YgShoppingCarExample example);

    int deleteByPrimaryKey(Long id);

    int insert(YgShoppingCar record);

    int insertSelective(YgShoppingCar record);

    List<YgShoppingCar> selectByExample(YgShoppingCarExample example);

    YgShoppingCar selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") YgShoppingCar record, @Param("example") YgShoppingCarExample example);

    int updateByExample(@Param("record") YgShoppingCar record, @Param("example") YgShoppingCarExample example);

    int updateByPrimaryKeySelective(YgShoppingCar record);

    int updateByPrimaryKey(YgShoppingCar record);

    int countSuper(String q);

    List<YgShoppingCar> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("q") String q);

    List<YgShoppingCarModel> selectShoppingCarList(@Param("queryInfo") QueryInfo queryInfo,
                                                   @Param("userId") Long userId, @Param("isCheck") Boolean isCheck,
                                                   @Param("salesPlatform") String salesPlatform);

    List<YgShoppingCar> selectBySkuIds(@Param("skuIds") Long[] skuIds, @Param("pType") PromotionType pType,
                                       @Param("userId") Long userId, @Param("salesPlatform") SalesPlatform salesPlatform);

    List<YgShoppingCar> selectBySkuIdsWithSku(@Param("skuIds") Long[] skuIds, @Param("pType") PromotionType pType, @Param("userId") Long userId);

    List<YgShoppingCarModel> selectIsCheck(@Param("userId") Long userId, @Param("salesPlatform") String salesPlatform);

    int addItemNum(@Param("skuId") Long skuId, @Param("userId") Long userId, @Param("quantity") Long quantity,
                   @Param("salesPlatform") SalesPlatform salesPlatform);

    int reduceItemNum(@Param("skuId") Long skuId, @Param("userId") Long userId, @Param("quantity") Long quantity,
                      @Param("salesPlatform") SalesPlatform salesPlatform);

    int selectItemCount(@Param("userId") Long userId, @Param("salesPlatform") SalesPlatform salesPlatform);

    int deleteCarByCheck(@Param("userId") Long userId, @Param("salesPlatform") SalesPlatform salesPlatform);

    YgShoppingCarModel selectShoppingCarByCarId(@Param("carId") Long carId);

    Boolean hasOtherNewCus(@Param("skuId") Long skuId, @Param("userId") Long userId, @Param("productId") Long productId);

    List<YgShoppingCarModel> selectItemInfoPt(@Param("skuList") List<YgPtSkuInfo> skuList, @Param("userId") Long userId);

    List<YgShoppingCarModel> selectItemInfo(@Param("skuList") List<BaseSkuInfo> skuList, @Param("userId") Long userId);

    List<YgShoppingCarModel> selectItemInfoByPromotionType(@Param("skuList") List<BaseSkuInfo> skuList, @Param("userId") Long userId,
                                                           @Param("promotionType") String promotionType);

    List<YgShoppingCarModel> selectShoppingCarListBySkuIds(@Param("skuIds") Long[] skuIds, @Param("userId") Long userId,
                                                           @Param("salesPlatform") String salesPlatform);

    List<ShoppingCarBasicData> selectCarBasicDataList(@Param("userId") Long userId, @Param("salesPlatform") SalesPlatform salesPlatform);

    List<ShoppingCarBasicData> selectCarBasicDataListBySkuId(@Param("userId") Long userId, @Param("salesType") PromotionType salesType,
                                                             @Param("skuList") List<Long> skuList);
}
